//所有接口返回数据类型都有的ts类型
export interface ResponseData {
  code: number;
  message: string;
  ok: boolean;
}

export interface SpuData {
  id?: number;
  spuName: string;
  category3Id: number | string;
  description: string;
  tmId: number | string;

  spuImageList: null | SpuImage[]; // spu图片数组
  spuSaleAttrList: null | SaleAttr[]; // spu销售属性
}
export type Records = SpuData[];
export interface SpuResponseData extends ResponseData {
  data: {
    records: Records;
    current: number;
    size: number;
    total: number;
    pages: number;
  };
}

// 品牌数据类型
export interface Trademark {
  id: number;
  tmName: string;
  logoUrl: string;
}
export interface AllTrademark extends ResponseData {
  data: Trademark[];
}

//商品的图片数据类型
export interface SpuImage {
  id?: number;
  createTime?: string;
  updateTime?: string;
  spuId?: number;
  imgName?: string;
  imgUrl?: string;

  name?: string;
  url?: string;
}
export interface SpuHasImage extends ResponseData {
  data: SpuImage[];
}

// 已有的销售属性值对象
export interface SaleAttrValue {
  id?: number;
  createTime?: null;
  updateTime?: null;
  spuId?: number;
  baseSaleAttrId: number | string;
  saleAttrValueName: string;
  saleAttrName?: string;
  isChecked?: null;
}
// export type SpuSaleAttrValueList = SaleAttrValue[];
export interface SaleAttr {
  id?: number;
  createTime?: null;
  updateTime?: null;
  spuId?: number;
  baseSaleAttrId: number | string;
  saleAttrName: string;
  spuSaleAttrValueList: SaleAttrValue[];
  flag?: boolean;
  saleAttrValue?: string;

  saleIdAndValueId?: string;
}
export interface SaleAttrResponseData extends ResponseData {
  data: SaleAttr[];
}

// 已有的销售属性数据类型
export interface HasSaleAttr {
  id: number;
  name: string;
}
export interface HasSaleAttrResponseData extends ResponseData {
  data: HasSaleAttr[];
}
